import 'package:json2dart_safe/json2dart.dart';

class EngagementDetailModel {
  int? meetUserId;
  String? nickName;
  int? meetType;
  List<BgImgs>? bgImgs;
  String? logo;
  String? provinceName;
  String? cityName;
  String? address;
  String? contactDtl;
  int? price;
  int? nightPrice;
  List<String>? serviceTags;
  String? info;
  int? unlockGold;
  bool? videoCert;
  String? certVideo;
  int? bu;
  int? lockNum;
  String? consumeForm;
  String? createdAt;
  int? freeNum;
  bool? isUnlock;
  bool? isAttention;
  String? domain;
  String? cdnRes;

  EngagementDetailModel({
    this.meetUserId,
    this.nickName,
    this.meetType,
    this.bgImgs,
    this.logo,
    this.provinceName,
    this.cityName,
    this.address,
    this.contactDtl,
    this.price,
    this.nightPrice,
    this.serviceTags,
    this.info,
    this.unlockGold,
    this.videoCert,
    this.certVideo,
    this.bu,
    this.lockNum,
    this.consumeForm,
    this.createdAt,
    this.freeNum,
    this.isUnlock,
    this.isAttention,
    this.domain,
    this.cdnRes,
  });

  Map<String, dynamic> toJson() {
    return Map<String, dynamic>()
      ..put('meetUserId', this.meetUserId)
      ..put('nickName', this.nickName)
      ..put('meetType', this.meetType)
      ..put('bgImgs', this.bgImgs?.map((v) => v.toJson()).toList())
      ..put('logo', this.logo)
      ..put('provinceName', this.provinceName)
      ..put('cityName', this.cityName)
      ..put('address', this.address)
      ..put('contactDtl', this.contactDtl)
      ..put('price', this.price)
      ..put('nightPrice', this.nightPrice)
      ..put('serviceTags', this.serviceTags)
      ..put('info', this.info)
      ..put('unlockGold', this.unlockGold)
      ..put('videoCert', this.videoCert)
      ..put('certVideo', this.certVideo)
      ..put('bu', this.bu)
      ..put('lockNum', this.lockNum)
      ..put('consumeForm', this.consumeForm)
      ..put('createdAt', this.createdAt)
      ..put('freeNum', this.freeNum)
      ..put('isUnlock', this.isUnlock)
      ..put('isAttention', this.isAttention)
      ..put('domain', this.domain)
      ..put('cdnRes', this.cdnRes);
  }

  EngagementDetailModel.fromJson(Map<String, dynamic> json) {
    this.meetUserId = json.asInt('meetUserId');
    this.nickName = json.asString('nickName');
    this.meetType = json.asInt('meetType');
    this.bgImgs = json['bgImgs'] != null
        ? List<BgImgs>.from(json['bgImgs'].map((v) => BgImgs.fromJson(v)))
        : null;
    this.logo = json.asString('logo');
    this.provinceName = json.asString('provinceName');
    this.cityName = json.asString('cityName');
    this.address = json.asString('address');
    this.contactDtl = json.asString('contactDtl');
    this.price = json.asInt('price');
    this.nightPrice = json.asInt('nightPrice');
    this.serviceTags = json.asList<String>('serviceTags', null);
    this.info = json.asString('info');
    this.unlockGold = json.asInt('unlockGold');
    this.videoCert = json.asBool('videoCert');
    this.certVideo = json.asString('certVideo');
    this.bu = json.asInt('bu');
    this.lockNum = json.asInt('lockNum');
    this.consumeForm = json.asString('consumeForm');
    this.createdAt = json.asString('createdAt');
    this.freeNum = json.asInt('freeNum');
    this.isUnlock = json.asBool('isUnlock');
    this.isAttention = json.asBool('isAttention');
    this.domain = json.asString('domain');
    this.cdnRes = json.asString('cdnRes');
  }

  static EngagementDetailModel toBean(Map<String, dynamic> json) =>
      EngagementDetailModel.fromJson(json);
}

class BgImgs {
  String? fileId;
  int? type;
  String? url;
  String? coverImg;
  String? playTime;
  String? size;
  String? authKey;

  BgImgs({
    this.fileId,
    this.type,
    this.url,
    this.coverImg,
    this.playTime,
    this.size,
    this.authKey,
  });

  Map<String, dynamic> toJson() {
    return Map<String, dynamic>()
      ..put('fileId', this.fileId)
      ..put('type', this.type)
      ..put('url', this.url)
      ..put('coverImg', this.coverImg)
      ..put('playTime', this.playTime)
      ..put('size', this.size)
      ..put('authKey', this.authKey);
  }

  BgImgs.fromJson(Map<String, dynamic> json) {
    this.fileId = json.asString('fileId');
    this.type = json.asInt('type');
    this.url = json.asString('url');
    this.coverImg = json.asString('coverImg');
    this.playTime = json.asString('playTime');
    this.size = json.asString('size');
    this.authKey = json.asString('authKey');
  }
}
